package com.ruoyi.community.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.community.domain.vo.ExerciseHistoryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.community.mapper.ExerciseHistoryMapper;
import com.ruoyi.community.domain.ExerciseHistory;
import com.ruoyi.community.service.IExerciseHistoryService;

/**
 * 活动记录Service业务层处理
 *
 * @author lj
 * @date 2022-02-22
 */
@Service
public class ExerciseHistoryServiceImpl implements IExerciseHistoryService
{
    @Autowired
    private ExerciseHistoryMapper exerciseHistoryMapper;

    /**
     * 查询活动记录
     *
     * @param id 活动记录主键
     * @return 活动记录
     */
    @Override
    public ExerciseHistory selectExerciseHistoryById(Long id)
    {
        return exerciseHistoryMapper.selectExerciseHistoryById(id);
    }

    /**
     * 查询活动记录列表
     *
     * @param exerciseHistory 活动记录
     * @return 活动记录
     */
    @Override
    public List<ExerciseHistory> selectExerciseHistoryList(ExerciseHistory exerciseHistory)
    {
        return exerciseHistoryMapper.selectExerciseHistoryList(exerciseHistory);
    }

    @Override
    public List<ExerciseHistoryVo> selectExerciseHistoryLists(ExerciseHistoryVo exerciseHistory) {
        return exerciseHistoryMapper.selectExerciseHistoryLists(exerciseHistory);
    }

    /**
     * 新增活动记录
     *
     * @param exerciseHistory 活动记录
     * @return 结果
     */
    @Override
    public int insertExerciseHistory(ExerciseHistory exerciseHistory)
    {
        exerciseHistory.setCreatTime(DateUtils.getNowDate());
        exerciseHistory.setUpdateTime(DateUtils.getNowDate());
        exerciseHistory.setDelFlag(0);
        return exerciseHistoryMapper.insertExerciseHistory(exerciseHistory);
    }

    /**
     * 修改活动记录
     *
     * @param exerciseHistory 活动记录
     * @return 结果
     */
    @Override
    public int updateExerciseHistory(ExerciseHistory exerciseHistory)
    {
        exerciseHistory.setUpdateTime(DateUtils.getNowDate());
        return exerciseHistoryMapper.updateExerciseHistory(exerciseHistory);
    }

    /**
     * 批量删除活动记录
     *
     * @param ids 需要删除的活动记录主键
     * @return 结果
     */
    @Override
    public int deleteExerciseHistoryByIds(Long[] ids)
    {
        return exerciseHistoryMapper.deleteExerciseHistoryByIds(ids);
    }

    /**
     * 删除活动记录信息
     *
     * @param id 活动记录主键
     * @return 结果
     */
    @Override
    public int deleteExerciseHistoryById(Long id)
    {
        return exerciseHistoryMapper.deleteExerciseHistoryById(id);
    }

    @Override
    public int updateExerciseHistoryByIds(Long[] ids) {
        return exerciseHistoryMapper.updateExerciseHistoryByIds(ids);
    }
}
